<?php
namespace wlcat\http\MiddleWare;
use wlcat\src\Request;

class SetReportingFrameMiddleWare implements MiddleFrameWareInterface{
    public function handle(Request $request, \Closure $next)
    {
        if (APP_DEBUG === true) {
            error_reporting(E_ALL);
            ini_set('display_errors','On');
        } else {
            error_reporting(E_ALL);
            ini_set('display_errors','Off');
            ini_set('log_errors', 'On');
            ini_set('error_log', RUNTIME_PATH. 'logs/error.log');
        }
        return $next($request);
    }
}